#include "stdafx.h"
#include "CppUnitTest.h"

#include <functional>

#include "../FizzBuzzLib/FizzBuzz.h"

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace FizzBuzzTests
  {     
  TEST_CLASS(FizzBuzzFunc)
    {
    public:

      TEST_METHOD(ShouldBe1When1)
        {
        Assert::AreEqual(std::string("1"), FizzBuzz(1));
        }
      TEST_METHOD(ShouldBeFizzBuzzWhenMod15EqualTo0)
        {
        Assert::AreEqual(std::string("FizzBuzz"), FizzBuzz(15));

        Assert::AreEqual(std::string("FizzBuzz"), FizzBuzz(30));
        }
      TEST_METHOD(ShouldBeFizzWhenMod3EqualTo0)
        {
        Assert::AreEqual(std::string("Fizz"), FizzBuzz(3));
        
        Assert::AreEqual(std::string("Fizz"), FizzBuzz(6));
        }
      TEST_METHOD(ShouldBeBuzzWhenMod5EqualTo0)
        {
        Assert::AreEqual(std::string("Buzz"), FizzBuzz(5));
        
        Assert::AreEqual(std::string("Buzz"), FizzBuzz(10));
        }
      TEST_METHOD(ShouldBeInRangeOf1_33)
        {
        auto check_minus_1 = std::bind(FizzBuzz, -1);
        Assert::ExpectException<std::out_of_range> (check_minus_1);
      
        auto check_0 = std::bind(FizzBuzz, 0);
        Assert::ExpectException<std::out_of_range> (check_0);
        
        auto check_34 = std::bind(FizzBuzz, 34);
        Assert::ExpectException<std::out_of_range> (check_34);
        }
      

    };
  }